	function Select(selectId, data) {
		this.selectId = selectId;
		this.selectObj = document.getElementById(selectId);
		if (data && data != null && data != "" && data != "null")
			this.value = data.split(",");
		else
			this.value = null;
		
		this.url = this.selectObj.getAttribute("url");
		this.content = this.selectObj.getAttribute("content");
		
		if (this.url == null && this.content != null) {
			this.url = "/content.xml?content=" + this.content;
		}
		
		this.method = this.selectObj.getAttribute("method");
		this.valueProperty = this.selectObj.getAttribute("valueProperty");
		this.textProperty = this.selectObj.getAttribute("textProperty");
		
		
		//记录dependon的参数
		this.param = {};
		this.free = {};
		this.removeParam = function (paramName) {
			if (paramName && paramName != "")
				delete this.param[paramName];
		};
		this.setParam = function (paramName, paramValue) {	
			if (paramName && paramName != "" && paramValue && paramValue != "") {
				this.param[paramName] = paramValue;
			}	
		};
		this.getParam = function () {
			return hashToParam(this.param);
		}
		this.isFree = function () {
			return hashToBool(this.free);
		}
		
		var oThis = this;
		var change = function () {
			oThis.value = oThis.getSelected();
		}
		if (document.all)
			this.selectObj.attachEvent("onchange", change);
		else
			this.selectObj.addEventListener("change", change, false);
	}
	
	//判断是否选中
	Select.prototype.isSelected = function (value) {
		for (var i = 0; this.value != null && i < this.value.length; i ++) {
			if (value == this.value[i]) return true;
		}
		return false;
	}
	
	//设定选中
	Select.prototype.setSelected = function () {
		var optionsObj = this.selectObj.options;
		for (i = 0; i < optionsObj.length; i ++) {
			var value = optionsObj.item(i).value;
			optionsObj.item(i).seleceted = this.isSelected(value);
		}
	}
	
	//获取选中的值
	Select.prototype.getSelected= function () {
		var optionsObj = this.selectObj.options;
		var ret = new Array();
		for (i = 0; i < optionsObj.length; i ++) {
			if (optionsObj.item(i).seleceted) 
			ret[ret.length] = optionsObj.item(i).value;
		}
		return ret;
	}

	//清除所有选项
	Select.prototype.clearOption = function () {
		if (typeof this.onOptionUnload == "function") {
			this.onOptionUnload();
		}
		
		var optionsObj = this.selectObj.options;
		for (k = optionsObj.length - 1; k >= 0 ; k --) {
			this.selectObj.removeChild(optionsObj.item(k));
		}
	}
	
	//添加一个选项
	Select.prototype.addOption = function (value, text) {
		var optionObj = document.createElement("OPTION");
		optionObj.value = value;
		optionObj.text = text;
		optionObj.selected = this.isSelected(value);
				
		if (document.all)
			this.selectObj.add(optionObj);
		else
			this.selectObj.appendChild(optionObj);				
	}

	//获取选项
	Select.prototype.fetchOption = function () {
		//url空，表示改select控件不是需要动态改变可选项的
		if (this.url == null) return;
		//处理带入的参数
		var fp = this.getParam();
		var fu = (fp && fp != null)?this.url + fp:this.url;
		
		//通过http提交请求
		var http = new HttpObject();
		var ret = null;
		if (this.method == 'POST')
			ret = http.httpPostReturnMaps(this.url, fp);
		else
			ret = http.httpGetReturnMaps(fu);
		
		//处理获取的数据
		if (isValid(this.valueProperty) && isValid(this.textProperty)) {
			//清除现有选项
			this.clearOption();
			//新增选项
			for (var i = 0; i < ret.length; i ++) {
				var v = ret[i][this.valueProperty];
				var t = ret[i][this.textProperty];	
				this.addOption(v, t);
			}
			//如果是IE，设定选项被选中
			
			if (document.all && this.value && this.value.length == 1)
				this.selectObj.value = this.value[0];
				
			if (typeof this.onOptionLoad == "function") {
				this.onOptionLoad();
			}
		}
	}
	
	//依赖关系
	Select.prototype.dependOn = function (dependOnId, weakDepend, dependParam) {
		var obj = this;
		var dependObj = document.getElementById(dependOnId);
		if (dependObj) {
			var change = function () {
				//以下是和控件相关的方法
				//如果依赖的控件值不为空
				if (dependObj.value && dependObj.value != "") {
					//允许改依赖开锁
					obj.free[dependOnId] = true;
					//参数带入
					if (dependParam) {
						obj.setParam(dependParam, dependObj.value);
					} else {
						obj.setParam(dependObj.name, dependObj.value);
					}
					//获取选项
					if (obj.isFree())
						obj.fetchOption();
				
				//如果依赖的控件值空
				} else {
					if (dependParam) {
						obj.removeParam(dependParam);
					} else {
						obj.removeParam(dependObj.name);
					}
					
					//如果弱依赖关系，那么则获取选项
					if (weakDepend) {
						obj.free[dependOnId] = true;
						if (obj.isFree())
							obj.fetchOption();
					//不是弱依赖关系，那么清除所有选项	
					} else {
						obj.free[dependOnId] = false;
						obj.clearOption();
					}
					
					
				}
			}
			//IE
			if (document.all)
				dependObj.attachEvent("onchange", change);
			//FireFox
			else
				dependObj.addEventListener("change", change, false);
			change();
		}
	}